package edu.sctu.yueding.activitys;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

import edu.sctu.yueding.R;
import edu.sctu.yueding.bean.JsonBaseBeen;
import edu.sctu.yueding.bean.OrderDetialBean;
import edu.sctu.yueding.bean.OrderInfoBean;

/**
 * Created by 鑫爷您慢点 on 2016/8/3.
 */
public class MyOrderMActivity extends BaseActivity{
    private TextView mBackTxt,id,number,status;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_order_list);
        initSystemBar(this,0);
        initView();
    }

    private void initView(){

        Log.e("uuuuuuuuuu", getIntent().getStringExtra("orderDetial"));

        String response = getIntent().getStringExtra("orderDetial");

        JsonBaseBeen<OrderDetialBean> orderDetialBeanJsonBaseBeen = JSON.parseObject(response, new TypeReference<JsonBaseBeen<OrderDetialBean>>() {
        }.getType());

        OrderDetialBean orderDetialBean = orderDetialBeanJsonBaseBeen.getData();

        mBackTxt = (TextView) findViewById(R.id.id_my_order_list_back_txt);
        status = (TextView) findViewById(R.id.detial_order_status);
        number = (TextView) findViewById(R.id.detial_order_number);
        id = (TextView) findViewById(R.id.detial_order_id);


        id.setText(orderDetialBean.getOrderNo());
        number.setText(orderDetialBean.getMembers());

        if (orderDetialBean.getStatus() == "3"){

            status.setText("待付款");

        }else  if (orderDetialBean.getStatus() == "0"){

            status.setText("已完成");

        }

        mBackTxt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
